package com.xiaodao.beanPostFactoryProcessor;

import com.xiaodao.beandefinition.HomeService;
import com.xiaodao.beandefinition.OrderService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.stereotype.Component;

//@Component
public class TestBeanFactoryPost implements BeanFactoryPostProcessor {
	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	/*	AnnotatedBeanDefinition indexDao = (AnnotatedBeanDefinition) beanFactory.getBeanDefinition("indexDao");
		indexDao.setScope("prototype");*/
		GenericBeanDefinition homeService = (GenericBeanDefinition) beanFactory.getBeanDefinition("homeService");
//		homeService.getConstructorArgumentValues().addGenericArgumentValue(beanFactory.getBeanDefinition("orderService"));
//		homeService.setLenientConstructorResolution(false);
//		homeService.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR);

//		homeService.setInstanceSupplier(()->new HomeService(beanFactory
//		.getBean(OrderService.class)));
	}
}
